package com.spark.market.service.impl;

import com.spark.market.api.dto.UserInfo;
import com.spark.market.dal.model.UserModel;
import com.spark.market.common.utils.AssertUtils;
import com.spark.market.service.UserQueryCoreService;
import com.spark.market.service.manager.UserManager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserQueryCoreServiceImpl implements UserQueryCoreService {

    @Resource
    private UserManager userManager;

    @Override
    public UserInfo queryUserInfo(Integer id) {
        AssertUtils.isNotNull(id, "userid is null");
        return userManager.queryUserById(id);
    }

    @Override
    public void queryOpt(String telephone) {
        AssertUtils.isNotNull(telephone, "telephone is null");
        userManager.createOptAndSave(telephone);
    }
}
